<!doctype html>



  


<html class="theme-next mist use-motion">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/vendors/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.0.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Revision Control," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.0.1" />






<meta name="description" content="说明：SCM (Source Code Management)的配置使用，包括Git、SVN等。">
<meta name="keywords" content="Revision Control">
<meta property="og:type" content="article">
<meta property="og:title" content="Subversion">
<meta property="og:url" content="http://bebetter.site/2017/01/12/Software/Revision control and collaborative development 版本控制和协同开发/Subversion/index.html">
<meta property="og:site_name" content="gatewayzy">
<meta property="og:description" content="说明：SCM (Source Code Management)的配置使用，包括Git、SVN等。">
<meta property="og:updated_time" content="2017-01-12T05:58:56.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Subversion">
<meta name="twitter:description" content="说明：SCM (Source Code Management)的配置使用，包括Git、SVN等。">



<script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Mist',
    sidebar: {"position":"right","display":"always"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: 0,
      author: '博主'
    }
  };
</script>




  <link rel="canonical" href="http://bebetter.site/2017/01/12/Software/Revision control and collaborative development 版本控制和协同开发/Subversion/"/>

  <title> Subversion | gatewayzy </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-right page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">gatewayzy</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">blog of gatewayzy</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                Subversion
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            <span class="post-meta-item-icon">
              <i class="fa fa-calendar-o"></i>
            </span>
            <span class="post-meta-item-text">发表于</span>
            <time itemprop="dateCreated" datetime="2017-01-12T13:58:19+08:00" content="2017-01-12">
              2017-01-12
            </time>
          </span>

          
            <span class="post-category" >
              &nbsp; | &nbsp;
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="https://schema.org/Thing">
                  <a href="/categories/Softwares/" itemprop="url" rel="index">
                    <span itemprop="name">Softwares</span>
                  </a>
                </span>

                
                

              
            </span>
          

          
            
          

          

          
          

          
        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <p><strong>说明：</strong>SCM (Source Code Management)的配置使用，包括Git、SVN等。<br><a id="more"></a></p>
<h2 id="SVN简介"><a href="#SVN简介" class="headerlink" title="SVN简介"></a>SVN简介</h2><hr>
<ul>
<li>SVN包括客户端和server端。推荐用TortoiseSVN + VisualSVN Server搭配。</li>
<li>客户端有VisualSVN、TortoiseSVN等。其中VisualSVN集成了Subversion和Apache，与Visual Studio集成在一起，但是需要收费；VisualSVN是免费自由软件，它是一个Windows平台下的Subversion用户端软件，以Windows shell extension的方式写成。</li>
<li>服务器端有Subversion、VisualSVN Server等。其中Subversion需要自己配置文件控制权限、一般还要配置Apache进行http web访问；VisualSVN Server免费，且集成了Subversion、Apache和用户权限管理等。</li>
</ul>
<h2 id="Subversion与apache2做Server"><a href="#Subversion与apache2做Server" class="headerlink" title="Subversion与apache2做Server"></a>Subversion与apache2做Server</h2><hr>
<ul>
<li>Linux下没有VisualSVN server软件，可以使用subversion作为服务器，但是只支持ftp和svn检索方式，不支持http和https检索方式。如要支持http和https，可以使用apache服务与subversion结合。</li>
</ul>
<h3 id="安装使用Subversion"><a href="#安装使用Subversion" class="headerlink" title="安装使用Subversion"></a>安装使用Subversion</h3><hr>
<ul>
<li>安装软件：        sudo apt-get install subversion</li>
<li>创建一个repo：    <code>sudo svnadmin create /home/myrepo</code></li>
<li>创建好的repo可以checkout下来然后commit初始化代码。</li>
<li>配置svn服务的配置文件svnserver.conf文件： vi /svn/project/conf/svnserve.conf</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">[general]</div><div class="line">anon-access = none</div><div class="line">auth-access = write</div><div class="line">password-db = /svn/project/conf/passwd</div><div class="line">authz-db = /svn/project/conf/authz</div><div class="line">realm = My Test Repository         #这是个提示信息</div></pre></td></tr></table></figure>
<ul>
<li>添加两个访问用户及口令： vi /svn/project/conf/passwd</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[users]</div><div class="line">xiaoran.shen = 123456</div><div class="line">test1 = 123456</div><div class="line">test2 = 123456</div></pre></td></tr></table></figure>
<ul>
<li>分配用户权限：    vi /home/svn/authz.conf</li>
<li>权限配置分析：配置分组，对每个repo的不同分组设置不同的权限，示例如下。</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div></pre></td><td class="code"><pre><div class="line">[groups]</div><div class="line">vip = wang</div><div class="line">admin = wangqixuan, yang</div><div class="line">develop-manager = zhong</div><div class="line">business-manager = shi</div><div class="line">developer = ma, hu, zhou, cen, huang</div><div class="line"></div><div class="line">[repos:/]</div><div class="line">@admin = rw</div><div class="line">* = r</div><div class="line"></div><div class="line">[repos:/develop/repo1]</div><div class="line">@vip =rw</div><div class="line">@admin = rw</div><div class="line">@develop-manager = rw</div><div class="line">* =</div><div class="line">[repos:/develop/repo1/repo2]</div><div class="line">@vip =rw</div><div class="line">@admin = rw</div><div class="line">@develop-manager = rw</div><div class="line">zhou = rw</div><div class="line">hu =rw</div><div class="line">ma = r</div><div class="line">* =</div></pre></td></tr></table></figure>
<p><code>*=</code>表示其他用户没有任何权限，@用户组，*用户，[/]表示全部目录，用户“a=r,b=r”这种不能合并成“a,b=r”。</p>
<h3 id="Subversion与apache结合"><a href="#Subversion与apache结合" class="headerlink" title="Subversion与apache结合"></a>Subversion与apache结合</h3><hr>
<p>在subversion基础上使用apache服务，可以支持http、https检索方式，并且配置用户时可以使用apache的用户配置，为所有项目进行统一配置，从而不必像subversion那样专门为每一个repo配置权限。</p>
<ul>
<li>安装apache2 服务：        sudo apt-get install apache2 </li>
<li>安装apache2 帮助命令：    sudo apt-get install apache2-utils </li>
<li>添加用户：    htpasswd -c /home/svn/passwd.conf user1（注意-c表示清除已有用户，普通添加不要写-c，用户的密码存储方式为MD5）</li>
<li>打开apache的dav_svn插件：<code>sudo a2enmod dav_svn</code></li>
<li>配置dav_svn的svn配置：<code>vi /&lt;apache-dir&gt;/mods-enable/dav_svn.conf</code>，去掉 <code>&lt;Location /svn&gt;</code> 的注释并加入下面设置，修改相应的svn目录、名称和密码目录等，Basic表示用户方式访问。</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">DAV svn</div><div class="line">SVNParentPath  /svn</div><div class="line">AuthType Basic</div><div class="line">AuthName &quot;svn repos&quot;</div><div class="line">AuthUserFile /svn/passwd</div><div class="line">Require valid-user</div></pre></td></tr></table></figure>
<ul>
<li>重启apache服务：sudo service apache2 restart，之后就可以正常使用svn客户端进行访问。</li>
<li>可能提交的时候遇到写权限问题，可以尝试对svn项目仓库的文件权限进行修改。将www-data（apache的默认用户名）加入到登录的组中，将登录的组设置仓库权限，命令为：<code>sudo chmod -R g+rwx svns</code>，这条命令允许所在组用户对版本库进行读写操作，-R是递归，g是group </li>
</ul>
<h2 id="VisualSVN-Server做Server"><a href="#VisualSVN-Server做Server" class="headerlink" title="VisualSVN Server做Server"></a>VisualSVN Server做Server</h2><hr>
<h3 id="Server设置"><a href="#Server设置" class="headerlink" title="Server设置"></a>Server设置</h3><hr>
<p>运行bin下的VisualSVN Server.msc打开服务器管理界面，进入设置界面即可。如果server启动失败可以用server安装程序进行repair。</p>
<ul>
<li>用户管理：server设置 -&gt;authentication添加用户名和密码。</li>
<li>存储管理：server设置 -&gt;storage</li>
</ul>
<h3 id="仓库管理"><a href="#仓库管理" class="headerlink" title="仓库管理"></a>仓库管理</h3><hr>
<p>建立新的仓库并初始化项目空间可以如下操作。</p>
<ul>
<li>Server中建立仓库。</li>
<li>将server对应的仓库url复制下来（注意将url修改为正确信息），在本地上checkout出来一个空的项目目录。</li>
<li>将本地项目代码复制到空的项目目录中，进行commit操作。</li>
</ul>
<h3 id="VisualSVN-Server仓库迁移到Linux"><a href="#VisualSVN-Server仓库迁移到Linux" class="headerlink" title="VisualSVN Server仓库迁移到Linux"></a>VisualSVN Server仓库迁移到Linux</h3><hr>
<p>如果svn服务器发生变化，需要对将svn进行迁移，迁移包含所有版本, 权限，用户信息。</p>
<ul>
<li>进入visualSVN server存储项目的repositories目录下，<code>svnadmin dump usercenter &gt; mysave.dump</code>（确定要备份的目录下有版本信息的format文件）</li>
<li>在subversion中创建一个repo，将dump备份拷贝到subversion机器中</li>
<li>将dump备份导入repo中：<code>svnadmin load myrepo &lt; mysave.dump</code></li>
<li>将客户端的地址更新：右键要更改的已有仓库-&gt;TortoiseSVN-&gt;Relocate-&gt;在To URL这一项里填：<code>http://10.15.82.52/svn/myrepo</code> -&gt;确定。然后就可以从新地址进行checkout了。或者进入项目目录下运行如下命令，再通过命令svn info查看是否成功。<br><code>svn switch --relocate https://10.15.82.58/svn/usercenter/ http://10.15.82.52/svn/usercenter</code></li>
</ul>
<h3 id="subversion定期导出"><a href="#subversion定期导出" class="headerlink" title="subversion定期导出"></a>subversion定期导出</h3><hr>
<p>使用上面的dump和load命令就可以定期对svn server进行定期备份和恢复，下面是一个示例dump出来进行备份的脚本。基本过程就是列出svn下面所有repo，然后导出到指定文件名，最后使用scp进行远程备份。注意shell编程中，<code>[ 判断语句 ]</code>前后的空格，时间使用的是`，不是引号。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div></pre></td><td class="code"><pre><div class="line">#!/bin/bash</div><div class="line">bakdate=`date &quot;+%Y-%m-%d&quot;`</div><div class="line">echo $bakdate</div><div class="line">mkdir ~/svn-bak/svn-$bakdate-bak</div><div class="line">cd ~/svn-bak/svn-$bakdate-bak</div><div class="line"></div><div class="line">for file in /svn/*</div><div class="line">do</div><div class="line">    if test -f $file</div><div class="line">    then</div><div class="line">         echo $file is f</div><div class="line">    fi</div><div class="line"></div><div class="line">    if test -d $file</div><div class="line">    then</div><div class="line">        echo $file is d</div><div class="line">        echo $(dirname $file)</div><div class="line">        echo $(basename $file)</div><div class="line"></div><div class="line">        if [ $(basename $file) == &apos;lost+found&apos; ]</div><div class="line">        then </div><div class="line">        echo $(basename $file) skipping.....</div><div class="line">        continue</div><div class="line">        else</div><div class="line">            echo &quot;root密码&quot; | sudo -S svnadmin dump $file &gt; $(basename $file)-$bakdate.dump</div><div class="line">            echo ok</div><div class="line">        fi</div><div class="line"></div><div class="line">    fi</div><div class="line">done</div><div class="line">echo ======  see ~/svn-bak/svn-$bakdate-bak  ===========</div><div class="line"></div><div class="line">topath=&quot;Administrator@10.15.62.205:/home/Administrator/16_tcm_backup/03-svn-backup/&quot;</div><div class="line">echo ======  sending files to  $topath, remote server\&apos;s password needed ===========</div><div class="line">echo &apos;root密码&apos; | sudo -S scp -r ~/svn-bak/svn-$bakdate-bak/ $topath</div></pre></td></tr></table></figure>
<h2 id="TortoiseSVN客户端使用"><a href="#TortoiseSVN客户端使用" class="headerlink" title="TortoiseSVN客户端使用"></a>TortoiseSVN客户端使用</h2><hr>
<h3 id="导入工程"><a href="#导入工程" class="headerlink" title="导入工程"></a>导入工程</h3><hr>
<p>新建文件夹，右键checkout，设置server的URL和本地路径，输入用户名密码。当然还可以设置导入的版本、勾选文件等，点show log可以查看日志。一般只下载源码等，服务器中和下载时都不要加入编译生成的文件（添加到ignore list）。</p>
<h3 id="Update与commit"><a href="#Update与commit" class="headerlink" title="Update与commit"></a>Update与commit</h3><hr>
<ul>
<li>更新与提交，一般先更新检查，看是否存在文件冲突，再提交。</li>
<li>如果存在冲突，可以先将本地代码剪切到其他地方，下载最新的版本，将自己代码冲突的文件融合进去，再提交。</li>
</ul>
<h3 id="增改删操作"><a href="#增改删操作" class="headerlink" title="增改删操作"></a>增改删操作</h3><hr>
<ul>
<li>在文件或目录上右键，TortoiseSVN-&gt;Add，Delete等，点OK，之后再commit。因为只有commit才会提交到服务器。</li>
<li>如果想让一个文件恢复到修改之前的版本，可以TortoiseSVN-&gt;revert。</li>
</ul>
<h3 id="分支管理"><a href="#分支管理" class="headerlink" title="分支管理"></a>分支管理</h3><hr>
<ol>
<li>创建一个项目，下面有trunk，branch，tag文件夹。</li>
<li>在trunk中添加初始化的代码工程，trunk就是主干版本。</li>
<li>在trunk上右击，选择创建branch/tag，如选取创建到/trunk/proj-1.0.0，然后update将会下载该分支内容。</li>
</ol>
<h3 id="工程代码管理"><a href="#工程代码管理" class="headerlink" title="工程代码管理"></a>工程代码管理</h3><hr>
<ul>
<li>项目右键选项说明：在项目源码文件夹上右键，可进行svn客户端的各种操作，部分说明如下。</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div></pre></td><td class="code"><pre><div class="line">Show log 看日志</div><div class="line">Repo-browser 看仓库文件目录</div><div class="line">Check formodifications 看文件修改</div><div class="line">Revision graph </div><div class="line">Resolve 处理版本冲突问题</div><div class="line">Update to version 版本选择</div><div class="line">Revert 放弃修改，本地的版本working copy（WC）会恢复到你修改前的状态，也就是说你最近的一次update后的版本。</div><div class="line">Clean up 删除文件副本</div><div class="line">Get lock 锁定文件，commit动作会自动锁定文件。</div><div class="line">Release lock 释放文件锁</div><div class="line">Branch/tag </div><div class="line">Switch </div><div class="line">Merge </div><div class="line">Export </div><div class="line">Relocate </div><div class="line">Add </div><div class="line">Unversion and add to ignore list </div><div class="line">Create patch </div><div class="line">Apply patch </div><div class="line">Properties 属性</div><div class="line">Setting 配置</div></pre></td></tr></table></figure>
<ul>
<li>文件右键说明：在项目文件上进行右键可以进行各种操作，部分说明如下。</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">Diff with previous version 和之前版本进行文件对比</div><div class="line">Delete 删除本地文件，当提交本地版本后将同步删除服务器中的该文件</div><div class="line">Blame 查找修改过的该文件的人</div></pre></td></tr></table></figure>
<h2 id="SVN的命令行操作"><a href="#SVN的命令行操作" class="headerlink" title="SVN的命令行操作"></a>SVN的命令行操作</h2><hr>
<ul>
<li>svn checkout URL （默认最新version）</li>
<li>svn checkout <a href="https://10.15.82.58/svn/usercenter/" target="_blank" rel="external">https://10.15.82.58/svn/usercenter/</a>  #第一次检出会出现密码等交互设置</li>
<li>svn add * 提交所有更新</li>
<li>svn commit -m “message”  更新到服务器</li>
<li>svn cleanup </li>
<li>svn update</li>
</ul>
<h2 id="问题与解决"><a href="#问题与解决" class="headerlink" title="问题与解决"></a>问题与解决</h2><hr>
<h3 id="强制commit操作提供messenge"><a href="#强制commit操作提供messenge" class="headerlink" title="强制commit操作提供messenge"></a>强制commit操作提供messenge</h3><hr>
<p>可以在客户端和服务器端分别设置。</p>
<ul>
<li>客户端设置（不推荐）只会在本地机器上生效，并不会影响其他分支:项目副本右键选择properties，添加一个log size设置即可。</li>
<li>服务器端设置（推荐）<ul>
<li>参考文章：<a href="http://www.cnblogs.com/chengxiaohui/articles/3780481.html" target="_blank" rel="external">SVN与TortoiseSVN修改日志和强制写日志实现详解</a></li>
<li>在server库的hooks目录下编写脚本（其实就是批处理文件）文件：pre-commit.bat，内容如下。想修改限制长度只需要增加或减少”…………………………”中点的数量。</li>
</ul>
</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">@echo off </div><div class="line">setlocal</div><div class="line">set REPOS=%1</div><div class="line">set TXN=%2</div><div class="line">rem check that logmessage contains at least 10 characters</div><div class="line">&quot;D:\Program Files\VisualSVN Server\bin/svnlook&quot; log &quot;%REPOS%&quot; -t &quot;%TXN%&quot; | findstr &quot;..........&quot; &gt; nul</div><div class="line">if %errorlevel% gtr 0 goto err</div><div class="line">exit 0</div><div class="line">:err</div><div class="line">echo 提交必须写10个字以上的日志!&gt;&amp;2</div><div class="line">exit 1</div></pre></td></tr></table></figure>
<h3 id="Can’t-convert-string-from-‘UTF-8’-to-native-encoding"><a href="#Can’t-convert-string-from-‘UTF-8’-to-native-encoding" class="headerlink" title="Can’t convert string from ‘UTF-8’ to native encoding"></a>Can’t convert string from ‘UTF-8’ to native encoding</h3><hr>
<ul>
<li>原因是文件目录使用了中文，SVN在Ubuntu下，ubuntu设置为utf-8，svn中就不能有中文文件路径。</li>
<li>方法1：可以改成英文文件名（推荐）</li>
<li>方法2：添加linux系统编码：需要修改<code>/home/.bash_profile</code>文件(可能要新建)就可以，添加下面几行，然后 <code>source .bash_profile</code>更新生效运行。</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">export LC_ALL=en_US.UTF-8</div><div class="line">export LANG=en_US.UTF-8</div><div class="line">export LANGUAGE=en_US.UTF-8</div></pre></td></tr></table></figure>
<h3 id="svn不是内部或外部命令"><a href="#svn不是内部或外部命令" class="headerlink" title="svn不是内部或外部命令"></a>svn不是内部或外部命令</h3><hr>
<ul>
<li>原因是安装svn客户端没有安装svn command line</li>
<li>运行TortoiseSVN安装程序，在modify中勾选上svn command line，或者一开始安装的时候就勾选上。</li>
</ul>
<h3 id="提交到subversion提示Permission-denied"><a href="#提交到subversion提示Permission-denied" class="headerlink" title="提交到subversion提示Permission denied"></a>提交到subversion提示Permission denied</h3><ul>
<li>原因是create repo的时候，使用的root，导致<code>mod_dav_svn</code>就没有write权限等.</li>
<li>解决方法：修改repo的owner和mod：<code>sudo chown -R zju:zju /svn/repo1</code> <code>sudo chmod -R u+x /svn/repo1</code></li>
</ul>
<h3 id="提交到subversion提示error-sqlite3-readonly"><a href="#提交到subversion提示error-sqlite3-readonly" class="headerlink" title="提交到subversion提示error sqlite3 readonly"></a>提交到subversion提示error sqlite3 readonly</h3><ul>
<li>原因是repo没有w权限</li>
<li>解决方法：修改repo权限，比如直接设置为chmod -R 777</li>
</ul>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Revision-Control/" rel="tag">#Revision Control</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/01/12/Software/Maintenance and monitoring 维护与监控/Nagios/" rel="next" title="Nagios">
                <i class="fa fa-chevron-left"></i> Nagios
              </a>
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/01/12/Software/Revision control and collaborative development 版本控制和协同开发/GitLab/" rel="prev" title="GitLab">
                GitLab <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    


  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/statics/images/avatar.png"
               alt="gatewayzy" />
          <p class="site-author-name" itemprop="name">gatewayzy</p>
          <p class="site-description motion-element" itemprop="description">blog website with hexo and github pages</p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">70</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">10</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">38</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-inline">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              友情链接
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="https://github.com/gatewayzy" title="Github-gatewayzy" target="_blank">Github-gatewayzy</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://google.com/" title="Goolge" target="_blank">Goolge</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://wiki.jikexueyuan.com/" title="Wiki-jike" target="_blank">Wiki-jike</a>
                </li>
              
            </ul>
          </div>
        

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">
            
              
            
            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#SVN简介"><span class="nav-number">1.</span> <span class="nav-text">SVN简介</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Subversion与apache2做Server"><span class="nav-number">2.</span> <span class="nav-text">Subversion与apache2做Server</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#安装使用Subversion"><span class="nav-number">2.1.</span> <span class="nav-text">安装使用Subversion</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Subversion与apache结合"><span class="nav-number">2.2.</span> <span class="nav-text">Subversion与apache结合</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#VisualSVN-Server做Server"><span class="nav-number">3.</span> <span class="nav-text">VisualSVN Server做Server</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Server设置"><span class="nav-number">3.1.</span> <span class="nav-text">Server设置</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#仓库管理"><span class="nav-number">3.2.</span> <span class="nav-text">仓库管理</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#VisualSVN-Server仓库迁移到Linux"><span class="nav-number">3.3.</span> <span class="nav-text">VisualSVN Server仓库迁移到Linux</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#subversion定期导出"><span class="nav-number">3.4.</span> <span class="nav-text">subversion定期导出</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#TortoiseSVN客户端使用"><span class="nav-number">4.</span> <span class="nav-text">TortoiseSVN客户端使用</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#导入工程"><span class="nav-number">4.1.</span> <span class="nav-text">导入工程</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Update与commit"><span class="nav-number">4.2.</span> <span class="nav-text">Update与commit</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#增改删操作"><span class="nav-number">4.3.</span> <span class="nav-text">增改删操作</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#分支管理"><span class="nav-number">4.4.</span> <span class="nav-text">分支管理</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#工程代码管理"><span class="nav-number">4.5.</span> <span class="nav-text">工程代码管理</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#SVN的命令行操作"><span class="nav-number">5.</span> <span class="nav-text">SVN的命令行操作</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#问题与解决"><span class="nav-number">6.</span> <span class="nav-text">问题与解决</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#强制commit操作提供messenge"><span class="nav-number">6.1.</span> <span class="nav-text">强制commit操作提供messenge</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Can’t-convert-string-from-‘UTF-8’-to-native-encoding"><span class="nav-number">6.2.</span> <span class="nav-text">Can’t convert string from ‘UTF-8’ to native encoding</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#svn不是内部或外部命令"><span class="nav-number">6.3.</span> <span class="nav-text">svn不是内部或外部命令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#提交到subversion提示Permission-denied"><span class="nav-number">6.4.</span> <span class="nav-text">提交到subversion提示Permission denied</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#提交到subversion提示error-sqlite3-readonly"><span class="nav-number">6.5.</span> <span class="nav-text">提交到subversion提示error sqlite3 readonly</span></a></li></ol></li></ol></div>
            
          </div>
        </section>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">gatewayzy</span>
</div>

<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>

        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/vendors/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/vendors/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.0.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.0.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.1"></script>



  



  




  
  

  
  <script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
        processEscapes: true,
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
  </script>

  <script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for (i=0; i < all.length; i += 1) {
        all[i].SourceElement().parentNode.className += ' has-jax';
      }
    });
  </script>
  <script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>



  

  
<script type="text/javascript" async src="//push.zhanzhang.baidu.com/push.js">
</script>


</body>
</html>
